import { lazy } from 'react';
// 路由懒加载
var Index=lazy(()=>import("../views/Index"))
var Regsiter=lazy(()=>import("../views/Regsiter"))
var Login=lazy(()=>import("../views/Login"))
var Fon=lazy(()=>import("../views/Fon"))
let Home=lazy(()=>import("../views/index/Home"))
let Goods=lazy(()=>import("../views/index/Goods"))
let Cate=lazy(()=>import("../views/index/Catenav"))
let Goodscart=lazy(()=>import("../views/index/Goodscart"))
let Mine=lazy(()=>import("../views/index/Mine"))
let Details=lazy(()=>import("../views/Details"))
let Collection=lazy(()=>import("../views/Collection"))
let router= [
    {
        path:"/index",
        component:Index,
        children:[
            {
                path:"/index/home",
                component:Home,
                exact:true
                
            },
            {
                path:"/index/cate",
                component:Cate,
                exact:true
                
            },
            {
                path:"/index/goods",
                component:Goods,
                exact:true
                
            },
            {
                path:"/index/goodscart",
                component:Goodscart,
                exact:true
                
            },
            {
                path:"/index/mine",
                component:Mine,
                exact:true
                
            },
            {
                from:"/index",
                to:"/index/home",
                redirect: true,
                exact:true
            },
        ]
    },
    {
        path:"/login",
        component:Login,
        exact:true
        
    },
    {
        path:"/regsiter",
        component:Regsiter,
        exact:true
    },
    {
        path:"/details/:id",
        component:Details,
        exact:true
    },
    {
        path:"/collection",
        component:Collection,
        exact:true
    },
    {
        from:"/",
        to:"/index",
        redirect: true,
        exact:true
    },
    {
        component:Fon,
        exact:true
    }
]
export default router